//
//  InfoItemModel.m
//  Utils
//
//  Created by enghou on 2018/6/4.
//  Copyright © 2018年 xyxorigation. All rights reserved.
//

#import "InfoItemModel.h"

@implementation InfoItemModel
-(instancetype)initWithSource:(NSDictionary *)source{
    self = [super initWithSource:source];
    if (self) {
        self.name = [self contentForKey:@"name" withSource:source];
        self.time = [self contentForKey:@"releaseTime" withSource:source];
        self.unit = [self contentForKey:@"releaseUnit" withSource:source];
        self.ids = [self contentForKey:@"id" withSource:source];
        self.subject = [self contentForKey:@"documentSubject" withSource:source];
        self.content = [self contentForKey:@"content" withSource:source];
        NSArray *files = [source objectForKey:@"files"];
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *element in files) {
            FileItemModel *model = [[FileItemModel alloc]initWithSource:element];
            [array addObject:model];
        }
        self.files = array;
        self.height = 80;
        if (self.files.count > 0) {
            self.height = 210;
        }
    }
    return self;
}

@end
